﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Transactions {
    import Classes.util.*;
    import GameMode.*;

    public class TGetVisitMission extends TMission {

        protected var m_missionHostId:String;
        protected var m_missionType:String;

        public function TGetVisitMission(_arg1:String, _arg2:String=null){
            this.m_missionHostId = _arg1;
            this.m_missionType = _arg2;
            Global.ui.updateVisitMode(true);
            Global.world.addGameMode(new GMVisit(_arg1), true);
            GameTransactionManager.addTransaction(new TInitialVisit(Global.player.uid, _arg1));
            GameTransactionManager.addTransaction(new TWorldLoad(_arg1), true, true);
        }
        override public function perform():void{
            if (this.m_missionType){
                signedCall("MissionService.getSpecificMission", this.m_missionHostId.toString(), this.m_missionType);
            } else {
                signedCall("MissionService.getRandomMission", this.m_missionHostId.toString());
            };
        }
        override protected function onComplete(_arg1:Object):void{
            var _local2:String;
            var _local3:String;
            var _local4:Boolean;
            var _local5:int;
            super.onComplete(_arg1);
            if (Global.isVisiting()){
                _local2 = Global.world.ownerId;
                _local3 = Global.player.getFriendFirstName(_local2);
                Global.ui.m_cityNamePanel.cityName = Global.player.getFriendCityName(_local2);
            };
            if (_arg1){
                _local4 = false;
                if (this.m_missionType){
                    _local5 = int(_arg1.lastMissionTime);
                    _local4 = validateMissionTime(_local5);
                } else {
                    if (Global.getVisiting() == m_mission.missionHostId){
                        _local4 = true;
                    };
                };
                if (_local4){
                    this.displayMission();
                } else {
                    sendNoMissionStats("friendVisit");
                };
            } else {
                sendNoMissionStats("friendVisit");
            };
        }
        override protected function displayMission(_arg1:String=""):void{
        }

    }
}//package Transactions 
